
import  torch
import torch.nn as nn

input_size = 5
hidden_size = 10
num_layers = 2
bidirectional = False

rnn = nn.RNN(input_size, hidden_size, num_layers,bidirectional = bidirectional)
print(rnn)

# 随机生成输入数据
input_seq = torch.randn(10, 32, 5)
# 初始化隐藏状态
h0 = torch.zeros(2, 32, 10)
output, hn = rnn(input_seq, h0)

print(output)






















































































